<?php

namespace app\modules\lenders\models;

use Yii;

/**
 * This is the model class for table "rah_lendinvestment".
 *
 * @property integer $lendInvestID
 * @property integer $lenderID
 * @property string $lendType
 * @property string $expireDate
 * @property string $investAmt
 * @property double $investRate
 * @property string $recycleType
 * @property string $investStatus
 * @property string $paymentType
 * @property integer $isDeleted
 * @property string $createTime
 * @property string $createUser
 * @property string $updateTime
 * @property string $updateUser
 * @property string $comments
 * @property string $payBankID
 * @property string $receiveBankID
 * @property string $contractNo
 * @property string $lenderNo
 * @property integer $seqNo
 * @property integer $isRedeemed
 * @property string $redeemDate
 * @property string $address
 * @property string $redeemType
 * @property string $querenshuTime
 * @property string $firstDate
 * @property string $redeemAmt
 * @property string $redeemOverDate
 * @property string $investMonth
 * @property string $qixiDate
 * @property string $innerComments
 * @property integer $companyID
 * @property integer $deptID
 * @property string $companyName
 * @property string $deptName
 * @property string $oralContractNo
 * @property string $renewContractNo
 * @property integer $addressID
 * @property integer $phoneID
 * @property string $renewDate
 * @property string $jixiaoDate
 * @property string $postType
 * @property integer $PartnerID
 * @property string $PartnerName
 * @property integer $AreaID
 * @property string $AreaName
 * @property string $generatedRightDate
 * @property integer $customerManagerID
 * @property string $customerManagerName
 * @property string $teamManagerName
 * @property integer $teamManagerID
 * @property string $operateManagerName
 * @property integer $operateManagerID
 * @property string $yunYingManagerName
 * @property integer $yunYingManagerID
 * @property string $yunYingManagerTeamBuildName
 * @property integer $yunYingManagerTeamBuildNameID
 * @property string $subCompanyManagerName
 * @property integer $subCompanyManagerID
 * @property string $VPName
 * @property integer $VPID
 * @property integer $auditStatus
 * @property string $payBankAmtDtl
 * @property string $investCode
 * @property string $renewalPrincipal
 * @property string $interest
 * @property string $renewalTypes
 * @property string $extraMoney
 * @property string $reciveDate
 * @property string $auditDate
 * @property string $kefuUpdateTime
 * @property string $vipLiCai
 * @property string $money
 * @property integer $telID
 * @property string $renewalComment
 * @property integer $oldLendInvestID
 * @property integer $isSpecial
 */
class Lendinvestment extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'rah_lendinvestment';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['lenderID', 'isDeleted', 'receiveBankID', 'seqNo', 'isRedeemed', 'companyID', 'deptID', 'addressID', 'phoneID', 'PartnerID', 'AreaID', 'customerManagerID', 'teamManagerID', 'operateManagerID', 'yunYingManagerID', 'yunYingManagerTeamBuildNameID', 'subCompanyManagerID', 'VPID', 'auditStatus', 'telID', 'oldLendInvestID', 'isSpecial'], 'integer'],
            [['expireDate', 'createTime', 'updateTime', 'redeemDate', 'querenshuTime', 'firstDate', 'redeemOverDate', 'qixiDate', 'renewDate', 'jixiaoDate', 'generatedRightDate', 'reciveDate', 'auditDate', 'kefuUpdateTime'], 'safe'],
            [['investAmt', 'investRate', 'redeemAmt', 'investMonth', 'renewalPrincipal', 'interest', 'extraMoney', 'money'], 'number'],
            [['lendType', 'investStatus', 'createUser', 'contractNo', 'lenderNo', 'oralContractNo', 'renewContractNo', 'postType', 'PartnerName', 'AreaName', 'renewalComment'], 'string', 'max' => 50],
            [['recycleType', 'updateUser', 'companyName', 'customerManagerName', 'teamManagerName', 'operateManagerName', 'yunYingManagerName', 'yunYingManagerTeamBuildName', 'subCompanyManagerName', 'VPName', 'vipLiCai'], 'string', 'max' => 20],
            [['paymentType', 'payBankID', 'address', 'deptName'], 'string', 'max' => 100],
            [['comments', 'innerComments'], 'string', 'max' => 500],
            [['redeemType'], 'string', 'max' => 45],
            [['payBankAmtDtl', 'renewalTypes'], 'string', 'max' => 255],
            [['investCode'], 'string', 'max' => 1000],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'lendInvestID' => '投资ID',
            'lenderID' => '理财客户ID',
            'lendType' => '投资方式',
            'expireDate' => '到期日期',
            'investAmt' => '投资金额',
            'investRate' => '理财产品利率',
            'recycleType' => '理财产品类型',
            'investStatus' => '投资状态',
            'paymentType' => '打款银行',
            'isDeleted' => '是否删除标志',
            'createTime' => '创建时间',
            'createUser' => '创建人',
            'updateTime' => '更新时间',
            'updateUser' => '更新人',
            'comments' => '备注',
            'payBankID' => '打款银行',
            'receiveBankID' => '收款银行',
            'contractNo' => '合同编号',
            'lenderNo' => 'Lender No',
            'seqNo' => 'Seq No',
            'isRedeemed' => '是否已赎回',
            'redeemDate' => '赎回日期',
            'address' => '地址',
            'redeemType' => '赎回类型',
            'querenshuTime' => '进账日期',
            'firstDate' => 'First Date',
            'redeemAmt' => '赎回金额',
            'redeemOverDate' => '赎回已处理日期',
            'investMonth' => '投资月数',
            'qixiDate' => '起息日期',
            'innerComments' => '内部备注',
            'companyID' => '当前公司ID',
            'deptID' => '当前部门ID',
            'companyName' => '当前公司名称',
            'deptName' => '当前部门名称',
            'oralContractNo' => '原合同号',
            'renewContractNo' => '续投合同编号',
            'addressID' => '账单地址',
            'phoneID' => '联系电话',
            'renewDate' => '续投日期',
            'jixiaoDate' => '绩效日期',
            'postType' => '邮寄方式',
            'PartnerID' => '合作商id',
            'PartnerName' => '合作商名称',
            'AreaID' => '作业管理部大区经理id',
            'AreaName' => '作业管理部大区经理',
            'generatedRightDate' => '债权匹配日期',
            'customerManagerID' => '客户经理ID',
            'customerManagerName' => '客户经理',
            'teamManagerName' => '团队经理',
            'teamManagerID' => '团队经理ID',
            'operateManagerName' => '营业部经理',
            'operateManagerID' => '营业部经理ID',
            'yunYingManagerName' => '运营部经理',
            'yunYingManagerID' => '运营部经理ID',
            'yunYingManagerTeamBuildName' => '运营部团建',
            'yunYingManagerTeamBuildNameID' => '运营部团建ID',
            'subCompanyManagerName' => '分公司经理',
            'subCompanyManagerID' => '分公司经理ID',
            'VPName' => '分管副总',
            'VPID' => '分管副总ID',
            'auditStatus' => '客服审核状态：默认0，100审核成功-1失败',
            'payBankAmtDtl' => 'Pay Bank Amt Dtl',
            'investCode' => 'Invest Code',
            'renewalPrincipal' => '续期本金',
            'interest' => '利息(续期利息)',
            'renewalTypes' => '续期类型',
            'extraMoney' => '额外金额',
            'reciveDate' => '接件时间',
            'auditDate' => '审核时间',
            'kefuUpdateTime' => '客服更新时间',
            'vipLiCai' => '理财类型（当客户经理为 VIP中心 时，需选择理财类型）',
            'money' => '赎回日报表的金额',
            'telID' => '当创建理财申请时，选择了座机号，关联rah_lenderphone表的的phoneID查询tel(座机号)',
            'renewalComment' => '理财的续期备注(赎回日报表中显示)',
            'oldLendInvestID' => '续期后原合同ID',
            'isSpecial' => '续期时，是否为特殊查询（0：非特殊查询；1：特殊查询）',
        ];
    }
      ///连接银行bank
    public function getBanks() {
        return $this->hasOne(Bank::className(), ['tablePK' => 'lenderID']);
    }
  ///连接理财表 lender
    public function getLenders() {
        return $this->hasOne(Lender::className(), ['lenderID' => 'lenderID']);
    }
}
